package cliente;

public class IU_Inicial extends javax.swing.JFrame {

    // Inicialização de instância única de IU_Inicial
    private static final IU_Inicial theIU_Inicial = new IU_Inicial();

    // Construtor privado
    private IU_Inicial(){
        initComponents();
        //this.setExtendedState(this.getExtendedState() | MAXIMIZED_BOTH);
    }

    // Ponto de acesso à instância única
    public static IU_Inicial getIU_Inicial(){
        return theIU_Inicial;
    }

    private void apresentarTelaDeConexaoRemota(){
        /* Chamado por: Jogador
         * Caso de uso: Entrar em Sala, VF1 */
        IU_ConexaoRemota.getIU_ConexaoRemota().exibirTela();
    }
    
    public void exibirTela(){
        getIU_Inicial().setVisible(true);
    }
    
    public void ocultarTela(){
        getIU_Inicial().setVisible(false);
    }
    
    public void fecharTela(){
        dispose();
    }
    
    public void desabilitarTela(){
        setEnabled(false);
    }
    
    public void habilitarTela(){
        setEnabled(true);
    }
    
    public void desabilitarBotaoConexaoRemota(){
        subMenuConexaoRemota_Inicial.setEnabled(false);
    }
    
     public void habilitarBotaoConexaoRemota(){
        subMenuConexaoRemota_Inicial.setEnabled(true);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuJogo_Inicial = new javax.swing.JMenu();
        subMenuConexaoRemota_Inicial = new javax.swing.JMenuItem();
        subMenuSair_Inicial = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Inicial");
        setName("frame_Inicial"); // NOI18N
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(51, 153, 0));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 399, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 242, Short.MAX_VALUE)
        );

        menuJogo_Inicial.setText("Jogo");

        subMenuConexaoRemota_Inicial.setText("Conexao remota");
        subMenuConexaoRemota_Inicial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenuConexaoRemota_InicialActionPerformed(evt);
            }
        });
        menuJogo_Inicial.add(subMenuConexaoRemota_Inicial);

        subMenuSair_Inicial.setText("Sair");
        subMenuSair_Inicial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenuSair_InicialActionPerformed(evt);
            }
        });
        menuJogo_Inicial.add(subMenuSair_Inicial);

        jMenuBar1.add(menuJogo_Inicial);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void subMenuConexaoRemota_InicialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenuConexaoRemota_InicialActionPerformed
    desabilitarTela();
    apresentarTelaDeConexaoRemota();
}//GEN-LAST:event_subMenuConexaoRemota_InicialActionPerformed

private void subMenuSair_InicialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenuSair_InicialActionPerformed
    fecharTela();
}//GEN-LAST:event_subMenuSair_InicialActionPerformed
    
/**
    * @param args the command line arguments
    */
//    public static void main(String args[]) {
//        IU_Inicial.getIU_Inicial().exibirTela();
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JMenu menuJogo_Inicial;
    private javax.swing.JMenuItem subMenuConexaoRemota_Inicial;
    private javax.swing.JMenuItem subMenuSair_Inicial;
    // End of variables declaration//GEN-END:variables

}
